package com.hk.web.domain.entity;

import com.hk.commons.domain.entity.IdEntity;
import com.hk.commons.enums.RoleType;
import com.hk.commons.enums.Whether;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 *
 * @author Antinomy
 * @date 17/7/25
 */
@Entity
@DynamicInsert
@DynamicUpdate
@EntityListeners(AuditingEntityListener.class)
public class UserRole extends IdEntity {

    @Column(columnDefinition = "varchar(50) NOT NULL comment 'uuid'")
    private String uuid;

    @Column(columnDefinition = "varchar(50) comment '名称'")
    private String name;

    @Column(columnDefinition = "varchar(40) NOT NULL comment '角色类型' ")
    @Enumerated(EnumType.STRING)
    private RoleType roleType;

    @Column(columnDefinition = "varchar(255) comment '描述'")
    private String description;

    @Column(columnDefinition = "varchar(10) comment '创建人'")
    private String creator;

    @Column(columnDefinition = "varchar(10) NOT NULL comment '是否删除'")
    @Enumerated(EnumType.STRING)
    private Whether deleted = Whether.NO;

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public RoleType getRoleType() {
        return roleType;
    }

    public void setRoleType(RoleType roleType) {
        this.roleType = roleType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public Whether getDeleted() {
        return deleted;
    }

    public void setDeleted(Whether deleted) {
        this.deleted = deleted;
    }
}
